package com.fyzk.utils;

import java.util.ArrayList;
import java.util.Random;

public class RandomUtil {
	
	public  static int[] randomNoRepeat(int count,int start,int max){
		int[] arr = new int[count];
		ArrayList<Integer> randomArr = new ArrayList<Integer>(); 
		for(int i = 0 ; i < count ; i ++){
			int j = (int) (Math.random() * max) + start;
			while(randomArr.contains(j)){
				j = (int) (Math.random() * max) + start;
			}
			randomArr.add(j);
			arr[i] = j;
		}
		return arr;
	}
	
	public static int[]  randomRepeat(int count,int start,int max){
		int[] arr = new int[count];
		ArrayList<Integer> randomArr = new ArrayList<Integer>(); 
		for(int i = 0 ; i < count ; i ++){
			int j = new Random().nextInt(max)+start;
			randomArr.add(j);
			arr[i] = j;
		}
		return arr;
	}

}